package com.fiberhome.nas.core.data.repository

import com.fiberhome.nas.core.database.datasource.UploadTaskDataSource
import com.fiberhome.nas.core.model.entity.UploadTask
import javax.inject.Inject
import javax.inject.Singleton

/**
 * 任务中心仓库
 */
@Singleton
class TaskCenterRepository @Inject constructor(
    private val uploadTaskDataSource: UploadTaskDataSource
) {

    /**
     * 获取所有上传任务
     */
    fun getAllUploadTasks() = uploadTaskDataSource.getAllUploadTasks()

    /**
     * 插入上传任务
     */
    suspend fun insertUploadTask(uploadTask: UploadTask) =
        uploadTaskDataSource.insertUploadTask(uploadTask)

    /**
     * 更新上传任务
     */
    suspend fun updateUploadTask(uploadTask: UploadTask) =
        uploadTaskDataSource.updateUploadTask(uploadTask)

    /**
     * 删除上传任务
     */
    suspend fun deleteUploadTask(taskId: String) =
        uploadTaskDataSource.deleteUploadTaskById(taskId)
}